#include "Objects.h"


/*======|Instantiation|=========*/
Player::Player()
	:BaseCharacter(0,0,5,IDLE_STATE,PLAYER_TYPE)
{
	m_pTexture = Graphics::Engine()->getTextureByIndex(PLAYER);
	m_pMesh = Graphics::Engine()->getMeshByIndex(PLAYER);
	m_fScale = 0.5f;
	m_stRotation.yaw = 180;
}

/*======|Input|=================*/
void Player::Update(DrawList List)
{
	RefreshBoundingBox();

	if(DirectInput::Engine()->keyDown(DIK_UP))
	{
		if(!isGoingToCollide(List,UP_DIR))
		{m_vPosition.z += Unit;}
		m_stRotation.yaw = 90;

	}

	if(DirectInput::Engine()->keyDown(DIK_DOWN))
	{
		if(!isGoingToCollide(List,DOWN_DIR))
		{m_vPosition.z -= Unit;}
		m_stRotation.yaw = -90;

	}

	if(DirectInput::Engine()->keyDown(DIK_LEFT))
	{
		if(!isGoingToCollide(List,LEFT_DIR))
		{m_vPosition.x -= Unit;}
		m_stRotation.yaw = 0;
	}

	if(DirectInput::Engine()->keyDown(DIK_RIGHT))
	{
		if(!isGoingToCollide(List,RIGHT_DIR))
		{m_vPosition.x += Unit;}
		m_stRotation.yaw = 180;

	}


}

